﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BlogKickStart.Models;
using System.Data;
using System.Data.OleDb;
using System.Configuration;

namespace BlogKickStart.Controllers
{
	public class ChangeThemeController : Controller
	{
		//
		// GET: /ChangeTheme/

		public ActionResult ChangeTheme()
		{
			using (BlogKickstartContext data = new BlogKickstartContext())
			{
				var themeName = (from p in data.Blogs
								 where p.BlogID == 1
								 select p.Style.StyleNM);

			}
			return View();
		}

		[HttpPost]
		public ActionResult ChangeTheme(string selection)
		{
			using (BlogKickstartContext data = new BlogKickstartContext())
			{
				var blog = data.Blogs.Single(n => n.BlogID == 1);
				blog.Style.StyleNM = selection;
				data.SaveChanges();
			}

			return RedirectToAction("Index", "BlogPost");
		}
	}
}
